home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / text0139.txt < prev    next >
Encoding:
Text File  |  1998-04-01  |  2.2 KB  |  64 lines

  1. >> If AGE<10
  2. >>    Print "You are less than 10 years old."
  3. >> else if AGE=21
  4. >>    Print "Hey!! Now you can drink alcohol in the U.S.!!"
  5. >> else
  6. >>    Print "WOW, you're OVER 21!!"
  7. >> endif
  8. >>   Well, problem is this won't work. 
  9.  
  10.    > Yes it will. I tried it.
  11.  
  12.       Very strange as I just tried it as well and AMOS gives an error
  13.       (missing End If) just as I suspected!!  The only thing I can 
  14.       assume is that you and Keith are using AMOS Pro which must
  15.       have changed things a bit.  In AMOS v1.36 it will NOT work.
  16.  
  17.  
  18. > The logic is the same too. Select..is just
  19. > more advanced in that it offers some extra features.
  20.  
  21.    The logic is NOT the same.  Look at the above code again.  This
  22.    will print "WOW, you're over 21!!" as long as AGE is greater than
  23.    9 and unequal to 21... 
  24.  
  25.  
  26. >>If AGE<10
  27. >>   Print "You are less than 10 years old."
  28. >>Else If AGE=21
  29. >>      Print"Hey!! Now you can drink alcohol in the U.S.!!"
  30. >>   Else If AGE>21
  31. >>         Print "WOW, you'r OVER 21!!"
  32. >>      End If
  33. >>   End If
  34. >>End If
  35.  
  36.    > That would trigger the error-system. One if and three end-ifs is
  37.    > plain wrong.
  38.  
  39.       Try it... it works fine. Look at the source, there ARE three Ifs.
  40.       It's the only way you can do it in AMOS v1.36 to use the style
  41.       you suggested.
  42.  
  43.  
  44. > That being said, this might be a bit clearer (arguably the "best"
  45. > method for AMOS) but it still lacks when compared to the
  46. > Select...Case style.  Anyway, the point is you are still looking at
  47. > the same two basic methods, the If...End If and the If...Else...EndIf
  48.  
  49.    > Yes but does it really matter? The result is what is importand
  50.    > and the if... else if... else end if... structure is quite close to
  51.    > the select.. syntax.
  52.  
  53.       Of course not.  Actually, I don't even know what we're debating
  54.       here!!  I was simply responding to the VB-guy's post about
  55.       Select...Case.  In the end, it doesn't matter to me: I'll use If...
  56.       EndIf, If...Else...EndIf, as it's six one way and half a dozen the
  57.       other, but the whole point of this thread was that it might be
  58.       nice to have support for SELECT...CASE in AMOS.  :-)
  59.  
  60.  
  61.                 Garfield Benjamin    e-mail:gbenjam@sosbbs.com
  62.         Website( http://www.sosbbs.com/~gbenjam ): 50% Complete 
  63.  
  64.